import React, { Component } from 'react'
import {
  View, TextInput, StyleSheet, Text, Image, SafeAreaView, Navigator, ScrollView, TouchableOpacity
} from 'react-native'
import NavBar from '../../../../components/PublicHeader';
import { Images } from '../../../../public/images/images'

export default class GeneralSettings extends Component {
  constructor(props) {
    super(props)
    this.state = {
      Generalsettingss: this.props.navigation.state.params.Generalsettingss,
      currency: this.props.navigation.state.params.currency,
      Generalsettingsss: [
        {
          name: '从手机相册选一张',
          url: 'myAlbum'
        },
        {
          name: '拍一张',
          url: 'details'
        }
      ]
    }
  }

  componentDidMount = () => {
    // console.log(this.state.currency)

  }

  onChangeText(text) {
    this.setState({
      searchText: text
    })
  };

  onClick() {

  }

  render() {
    return (
      <SafeAreaView style={styles.container}>
        <NavBar
          navigation={this.props.navigation}
          title={"通用设置"}
        />
        <View style={styles.Generals}>
          {
            this.state.Generalsettingss.map((item, index) => (
              <View key={index}  >
                <TouchableOpacity key={index} style={styles.General} onPress={() => (
                  index == 0 ? this.props.navigation.navigate(item.url,
                    { Generalsettingsss: this.state.Generalsettingsss }
                  ) : this.props.navigation.navigate(item.url)
                )}>
                  <Text style={{ lineHeight: 40 }}>{item.name}</Text>
                  <Text style={{
                    lineHeight: 30,
                    marginRight: '7%',
                  }}>
                    <Image source={require('../../../../assets/images/maillist/Vector.png')} />
                  </Text>
                </TouchableOpacity>
              </View>
            ))}
        </View>
        <View style={{
          marginTop: "10%",
          backgroundColor: 'white'
        }}>
          <TouchableOpacity style={styles.General}>
            <Text style={{ lineHeight: 40 }}>{this.state.currency[3]}</Text>
            <Text style={{ lineHeight: 30, marginRight: '7%', }}><Image source={require('../../../../assets/images/maillist/Vector.png')}  ></Image></Text>
          </TouchableOpacity>
        </View>
      </SafeAreaView >
    )
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    display: 'flex',
    textAlign: 'center'
  },
  layer: {
    display: 'flex',
    justifyContent: 'space-around'
    , alignItems: 'center',
    flexDirection: 'row',
    marginTop: 20

  },
  General: {
    flexDirection: 'row',
    height: 55,
    marginLeft: 15,
    alignItems: "center",
    justifyContent: 'space-between',
    borderBottomWidth: 1,
    borderBottomColor: '#f2f2f2'
  },
  Generals: {
    marginTop: '4%',
    backgroundColor: 'white'
  },
  text: {
    fontSize: 16,
  },

})